package com.learn.initbean.Initializingbean;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.core.io.ClassPathResource;

/**
 * @author daify
 * @date 2019-03-23 14:39
 */
public class InitializingTest2 {

    public static void main(String[] args) {
        ClassPathResource resource = new ClassPathResource("spring4.xml");
        DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory);
        reader.loadBeanDefinitions(resource);

        InitializingBeanTest test = (InitializingBeanTest) factory.getBean("initializingBeanTest");
        System.out.println("name ：" + test.getName());
    }
}
